<?php
namespace Api\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function _initialize(){
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Methods:GET');
        header('Access-Control-Allow-Methods:POST');
        header('Access-Control-Allow-Headers:x-requested-with,content-type');
    }

    public function index(){
        $filename = dirname(__FILE__) . "/api.json";//文件相对路径
        $json_string = file_get_contents($filename);//读取json内容
        $this->assign("api",$json_string);
        $this->display();
    }
    public function second(){
        $filename=dirname(__FILE__)."/secondapi.json";
        $json_string=file_get_contents($filename);
        $this->assign("api",$json_string);
        $this->display();
    }

}